<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qsgmaterial.cpp -->
  <title>RenderState 类 | Qt Quick 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtquick-index.html">Qt Quick 模块</a></td><td ><a href="qtquick-module.html">C++ 类</a></td><td >RenderState</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">目录</a></h3>
<ul>
<li class="level1"><a href="#public-types">公用类型</a></li>
<li class="level1"><a href="#public-functions">公用函数</a></li>
<li class="level1"><a href="#details">详细信息</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">RenderState 类</h1>
<span class="small-subtitle">(<a href="qsgmaterialshader-renderstate.html">QSGMaterialShader::RenderState</a>)<br/></span>
<!-- $$$RenderState-brief -->
<p>The <a href="qsgmaterialshader-renderstate.html">QSGMaterialShader::RenderState</a> encapsulates the current rendering state during a call to <a href="qsgmaterialshader.html#updateState">QSGMaterialShader::updateState</a>(). <a href="#details">更多...</a></p>
<!-- @@@RenderState -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign">头文件：</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;RenderState&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += quick</td></tr></table></div><ul>
<li><a href="qsgmaterialshader-renderstate-members.html">所有成员的列表，包括继承成员</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">公用类型</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#DirtyState-enum">DirtyState</a></b> { DirtyMatrix, DirtyOpacity, DirtyCachedMaterialData, DirtyAll }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#DirtyState-enum">DirtyStates</a></b></td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">公用函数</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QMatrix4x4 </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#combinedMatrix">combinedMatrix</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QOpenGLContext *</td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#context">context</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> float </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#determinant">determinant</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> float </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#devicePixelRatio">devicePixelRatio</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#deviceRect">deviceRect</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> RenderState::DirtyStates </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#dirtyStates">dirtyStates</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#isCachedMaterialDataDirty">isCachedMaterialDataDirty</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#isMatrixDirty">isMatrixDirty</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#isOpacityDirty">isOpacityDirty</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMatrix4x4 </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#modelViewMatrix">modelViewMatrix</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> float </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#opacity">opacity</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMatrix4x4 </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#projectionMatrix">projectionMatrix</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qsgmaterialshader-renderstate.html#viewportRect">viewportRect</a></b>() const</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$RenderState-description -->
<div class="descr">
<h2 id="details">详细信息</h2>
<p>The <a href="qsgmaterialshader-renderstate.html">QSGMaterialShader::RenderState</a> encapsulates the current rendering state during a call to <a href="qsgmaterialshader.html#updateState">QSGMaterialShader::updateState</a>().</p>
<p>The render state contains a number of accessors that the shader needs to respect in order to conform to the current state of the scene graph.</p>
<p>The instance is only valid inside a call to <a href="qsgmaterialshader.html#updateState">QSGMaterialShader::updateState</a>() and should not be used outisde this function.</p>
</div>
<!-- @@@RenderState -->
<div class="types">
<h2>成员类型文档</h2>
<!-- $$$DirtyState$$$DirtyMatrix$$$DirtyOpacity$$$DirtyCachedMaterialData$$$DirtyAll -->
<h3 class="flags" id="DirtyState-enum"><a name="DirtyState-enum"></a>enum RenderState::<span class="name">DirtyState</span><br/>flags RenderState::<span class="name">DirtyStates</span></h3>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QSGMaterialShader::RenderState::DirtyMatrix</code></td><td class="topAlign tblval"><code>0x0001</code></td><td class="topAlign">Used to indicate that the matrix has changed and must be updated.</td></tr>
<tr><td class="topAlign"><code>QSGMaterialShader::RenderState::DirtyOpacity</code></td><td class="topAlign tblval"><code>0x0002</code></td><td class="topAlign">Used to indicate that the opacity has changed and must be updated.</td></tr>
<tr><td class="topAlign"><code>QSGMaterialShader::RenderState::DirtyCachedMaterialData</code></td><td class="topAlign tblval"><code>0x0004</code></td><td class="topAlign">Used to indicate that the cached material data have changed and must be updated.</td></tr>
<tr><td class="topAlign"><code>QSGMaterialShader::RenderState::DirtyAll</code></td><td class="topAlign tblval"><code>0xFFFF</code></td><td class="topAlign">Used to indicate that everything needs to be updated.</td></tr>
</table></div>
<p>The DirtyStates type is a typedef for <a href="../qtcore/qflags.html">QFlags</a>&lt;DirtyState&gt;. It stores an OR combination of DirtyState values.</p>
<!-- @@@DirtyState -->
</div>
<div class="func">
<h2>成员函数文档</h2>
<!-- $$$combinedMatrix[overload1]$$$combinedMatrix -->
<h3 class="fn" id="combinedMatrix"><a name="combinedMatrix"></a><span class="type"><a href="../qtgui/qmatrix4x4.html">QMatrix4x4</a></span> RenderState::<span class="name">combinedMatrix</span>() const</h3>
<p>Returns the matrix combined of modelview matrix and project matrix.</p>
<!-- @@@combinedMatrix -->
<!-- $$$context[overload1]$$$context -->
<h3 class="fn" id="context"><a name="context"></a><span class="type"><a href="../qtgui/qopenglcontext.html">QOpenGLContext</a></span> *RenderState::<span class="name">context</span>() const</h3>
<p>Returns the <a href="../qtgui/qopenglcontext.html">QOpenGLContext</a> that is being used for rendering</p>
<!-- @@@context -->
<!-- $$$determinant[overload1]$$$determinant -->
<h3 class="fn" id="determinant"><a name="determinant"></a><span class="type">float</span> RenderState::<span class="name">determinant</span>() const</h3>
<p>Returns the modelview determinant to be used for rendering.</p>
<!-- @@@determinant -->
<!-- $$$devicePixelRatio[overload1]$$$devicePixelRatio -->
<h3 class="fn" id="devicePixelRatio"><a name="devicePixelRatio"></a><span class="type">float</span> RenderState::<span class="name">devicePixelRatio</span>() const</h3>
<p>Returns the ratio between physical pixels and device-independent pixels to be used for rendering.</p>
<!-- @@@devicePixelRatio -->
<!-- $$$deviceRect[overload1]$$$deviceRect -->
<h3 class="fn" id="deviceRect"><a name="deviceRect"></a><span class="type"><a href="../qtcore/qrect.html">QRect</a></span> RenderState::<span class="name">deviceRect</span>() const</h3>
<p>Returns the device rect of the surface being rendered to</p>
<!-- @@@deviceRect -->
<!-- $$$dirtyStates[overload1]$$$dirtyStates -->
<h3 class="fn" id="dirtyStates"><a name="dirtyStates"></a><span class="type"><a href="qsgmaterialshader-renderstate.html#DirtyState-enum">RenderState::DirtyStates</a></span> RenderState::<span class="name">dirtyStates</span>() const</h3>
<p>Returns which rendering states that have changed and needs to be updated for geometry rendered with this material to conform to the current rendering state.</p>
<!-- @@@dirtyStates -->
<!-- $$$isCachedMaterialDataDirty[overload1]$$$isCachedMaterialDataDirty -->
<h3 class="fn" id="isCachedMaterialDataDirty"><a name="isCachedMaterialDataDirty"></a><span class="type">bool</span> RenderState::<span class="name">isCachedMaterialDataDirty</span>() const</h3>
<p>Returns <code>true</code> if the <a href="qsgmaterialshader-renderstate.html#dirtyStates">dirtyStates</a>() contains the dirty cached material state, otherwise returns <code>false</code>.</p>
<!-- @@@isCachedMaterialDataDirty -->
<!-- $$$isMatrixDirty[overload1]$$$isMatrixDirty -->
<h3 class="fn" id="isMatrixDirty"><a name="isMatrixDirty"></a><span class="type">bool</span> RenderState::<span class="name">isMatrixDirty</span>() const</h3>
<p>Returns <code>true</code> if the <a href="qsgmaterialshader-renderstate.html#dirtyStates">dirtyStates</a>() contain the dirty matrix state, otherwise returns <code>false</code>.</p>
<!-- @@@isMatrixDirty -->
<!-- $$$isOpacityDirty[overload1]$$$isOpacityDirty -->
<h3 class="fn" id="isOpacityDirty"><a name="isOpacityDirty"></a><span class="type">bool</span> RenderState::<span class="name">isOpacityDirty</span>() const</h3>
<p>Returns <code>true</code> if the <a href="qsgmaterialshader-renderstate.html#dirtyStates">dirtyStates</a>() contains the dirty opacity state, otherwise returns <code>false</code>.</p>
<!-- @@@isOpacityDirty -->
<!-- $$$modelViewMatrix[overload1]$$$modelViewMatrix -->
<h3 class="fn" id="modelViewMatrix"><a name="modelViewMatrix"></a><span class="type"><a href="../qtgui/qmatrix4x4.html">QMatrix4x4</a></span> RenderState::<span class="name">modelViewMatrix</span>() const</h3>
<p>Returns the model view matrix.</p>
<p>If the material has the RequiresFullMatrix flag set, this is guaranteed to be the complete transform matrix calculated from the scenegraph.</p>
<p>However, if this flag is not set, the renderer may choose to alter this matrix. For example, it may pre-transform vertices on the CPU and set this matrix to identity.</p>
<p>In a situation such as the above, it is still possible to retrieve the actual matrix determinant by setting the RequiresDeterminant flag in the material and calling the <a href="qsgmaterialshader-renderstate.html#determinant">determinant</a>() accessor.</p>
<!-- @@@modelViewMatrix -->
<!-- $$$opacity[overload1]$$$opacity -->
<h3 class="fn" id="opacity"><a name="opacity"></a><span class="type">float</span> RenderState::<span class="name">opacity</span>() const</h3>
<p>Returns the accumulated opacity to be used for rendering.</p>
<!-- @@@opacity -->
<!-- $$$projectionMatrix[overload1]$$$projectionMatrix -->
<h3 class="fn" id="projectionMatrix"><a name="projectionMatrix"></a><span class="type"><a href="../qtgui/qmatrix4x4.html">QMatrix4x4</a></span> RenderState::<span class="name">projectionMatrix</span>() const</h3>
<p>Returns the projection matrix.</p>
<!-- @@@projectionMatrix -->
<!-- $$$viewportRect[overload1]$$$viewportRect -->
<h3 class="fn" id="viewportRect"><a name="viewportRect"></a><span class="type"><a href="../qtcore/qrect.html">QRect</a></span> RenderState::<span class="name">viewportRect</span>() const</h3>
<p>Returns the viewport rect of the surface being rendered to.</p>
<!-- @@@viewportRect -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
